﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Threading.Tasks;
using 字符串处理工具.ViewModel;
using 字符串处理工具.Helpers;
using System.Windows.Controls;
using System.Windows.Media;

namespace 字符串处理工具
{
    public class MainViewModel : BindableBase
    {

        #region 属性
        private List<ButtonEntity> buttonList;

        public List<ButtonEntity> ButtonList
        {
            get { return buttonList; }
            set { buttonList = value; }
        }
        #endregion

        #region 事件
        public DelegateCommand CloseCommand { get; set; }
        public DelegateCommand<object> SelectItemChangedCommand { get; set; }
        #endregion

        #region 构造函数 初始化一些数据
        public MainViewModel()
        {
            #region 初始化属性
            ButtonList = new List<ButtonEntity>()
            {
                new ButtonEntity() { Name = "列表去重" },
                new ButtonEntity() { Name = "两个列表进行计算" },
                new ButtonEntity() { Name = "列表3" },
                new ButtonEntity() { Name = "列表4" },
            };
            #endregion

            #region 初始化事件
            CloseCommand = new DelegateCommand(() =>
            {
                Application.Current.Shutdown();
            });

            SelectItemChangedCommand = new DelegateCommand<object>((p) =>
            {
                ListView lv = p as ListView;
                var buttonEntity = lv.SelectedItem as ButtonEntity;
                string buttonName = buttonEntity.Name;
                DependencyObject o = new DependencyObject();
                Button bb = new Button();
                var listsss = VisualTreeHelper.GetChildrenCount(new Button());

                var sss = Button.ClickEvent.Name;

                //Window.GetWindow()


                //VisualTreeHelper

                //Application.Current.Shutdown();


            });

            //DataGridHelper dd = new DataGridHelper();

            
            #endregion
        }

        #endregion

    }
}
